﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;





public class ProgramLemon3
{
    public static void MainLemon3()
    {
        //先读取输入创建链表
        string line;


        ListNodeLemon head = new ListNodeLemon(-1);
        ListNodeLemon cur = head;


        int ans = 0;
        line = Console.ReadLine();

        // 注意，如果输入是多个测试用例，请通过while循环处理多个测试用例
        string[] tokens = line.Split();

        for (int j = 0; j < tokens.Length; j++)
        {
            ans = int.Parse(tokens[j]);
            //ans加入链表
            cur.next = new ListNodeLemon(ans);
            cur = cur.next;


        }




        SolLemon3 solLemon = new SolLemon3();
        ListNodeLemon res = solLemon.ListSort(head.next);

        while (res != null)
        {
            Console.Write(res.val + " ");
            res = res.next;
        }

    }
}


public class SolLemon3
{
    public ListNodeLemon ListSort(ListNodeLemon head)
    {
        if(head.next==null) return head;//一个元素

       
        ListNodeLemon dummyhead = new ListNodeLemon(-2);//虚拟节点
        dummyhead.next = head;

      
        bool flag =true;//标记是否发生了交换

        while (flag)
        {
         
            flag = false;
            ListNodeLemon pre = dummyhead;
            ListNodeLemon cur = pre.next;
            ListNodeLemon next = cur.next;
            while (next != null)
            {
                

                if(cur.val>next.val)//交换
                {
                  
                    flag = true;
                    cur.next = next.next;
                    next.next = cur;
                    pre.next = next;
                    pre = next;
                    cur = pre.next;
                    next = cur.next;
                }
                else
                {
                    pre = cur;
                    cur = next;
                    next = next.next;

                }

            }


                

        }




        return dummyhead.next;

    }


}


